<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="ot" uri="http://www.ideyatech.com/tides"%>
<%@ taglib prefix="idy" tagdir="/WEB-INF/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<idy:bs-iris-header title_webpage="title.program.form">
	
</idy:bs-iris-header>

<div class="page-body">
	<div class="form-box-title">
		<h4>
			<c:if test="${param.action eq 'create'}">
				Create a new program
			</c:if>
			<c:if test="${param.action eq 'update'}">
				Update an existing program
			</c:if>
		</h4>
	</div>
	<hr/>
	<form:form id="add-treatment-form" method="POST" commandName="patientMedicalProgram" cssClass="form-horizontal">
		<spring:bind path="patientMedicalProgram.*">
			<c:if test="${status.error}">
				<div class='alert alert-error'>
					<strong>Oh snap! </strong>
					<form:errors path="*" />
				</div>
			</c:if>
		</spring:bind>
		<div class="control-group">
			<label class="control-label">Patient</label>
			<div class="controls">
				<input type="text" value="${patientMedicalProgram.patient.fullName}" disabled="disabled"/><span class="required-field">*</span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">Program Name</label>
			<div class="controls">
				<form:input path="name" autocomplete="off"/><span class="required-field">*</span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">Created by</label>
			<div class="controls">
				<form:select path="createdBy">
					<form:options items="${staffs}" itemLabel="prettyName" itemValue="id"/>
				</form:select><span class="required-field">*</span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">Description</label>
			<div class="controls">
				<form:textarea path="description" cssClass="wider"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">Goals</label>
			<div class="controls">
				<form:textarea path="goal" cssClass="wider"/>
			</div>
		</div>
		
		<br/>
		<div class="control-group">
			<label class="control-label">Result</label>
			<div class="controls">
				<form:select path="resultStatus" cssClass="narrow">
					<form:options items="${resultStatuses}" itemLabel="value" itemValue="id"/>
				</form:select><span class="required-field">*</span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">Result Summary</label>
			<div class="controls">
				<span class="text-info"><strong>Hey!</strong> there's no need to add a summary if the program isn't finished yet</span>
				<form:textarea path="resultSummary" cssClass="wider"/>
			</div>
		</div>
		
		
		<div class="control-group">
			<div class="controls">
				<input type="submit" value="Save" class="btn btn-primary"/>
				<a class="btn" href="${url_context}/patient.jspx?id=${patientMedicalProgram.patient.id}&item=Program">Cancel</a>
			</div>
		</div>
	</form:form>
</div>

<idy:bs-iris-footer>

</idy:bs-iris-footer>